package org.summerframework.component.security.events;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

/**
 * @author 石超
 * @version v1.0.0
 */
@Getter
@Setter
public class PermissionsUpdateEvent extends ApplicationEvent {
    private String userId;
    private PermissionsTypeEnum type;

    public PermissionsUpdateEvent(String userId, PermissionsTypeEnum type) {
        super(userId);
        this.userId = userId;
        this.type = type;
    }

    public enum PermissionsTypeEnum {
        //权限类型
        MENU, ROLE, PERMISSIONS, ORGAN, ALL;

        public static boolean isTypeAndAll(PermissionsTypeEnum type, PermissionsTypeEnum type1) {
            return type == type1 || type == ALL;
        }


    }
}
